<!doctype html>
<html>
<head>
<meta charset="UTF-8" />
<title>后台管理</title>
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/main.css" />
<script src="assets/js/jquery.min.js"></script>
</head>
<body>
	<div class="topbar-wrap white">
		<div class="topbar-inner clearfix">
			<div class="topbar-logo-wrap clearfix">
				<h1 class="topbar-logo none">
					<a href="index.html" class="navbar-brand">后台管理</a>
				</h1>
				<ul class="navbar-list clearfix">
					<li><a class="on" href="index.html">首页</a></li>
					<li><a href="#" target="_blank">网站首页</a></li>
				</ul>
			</div>
			<div class="top-info-wrap">
				<ul class="top-info-list clearfix">
					<li><a href="#">管理员</a></li>
					<li><a href="#">修改密码</a></li>
					<li><a href="#">退出</a></li>
				</ul>
			</div>
		</div>
	</div>
	<div class="container clearfix">
		<div class="sidebar-wrap">
			<div class="sidebar-title">
				<h1>菜单</h1>
			</div>
			<div class="sidebar-content">
				<ul class="sidebar-list">
					<li><a href="#"><i class="icon-font">&#xe003;</i>常用操作</a>
						<ul class="sub-menu">
							<li><a href="index.html"><i class="icon-font">&#xe008;</i>用户管理</a></li>
							<li><a href="products.html"><i class="icon-font">&#xe005;</i>作品管理</a></li>
							<li><a href="sowing.html"><i class="icon-font">&#xe006;</i>轮播图管理</a></li>
							<li><a href="index.html"><i class="icon-font">&#xe004;</i>留言管理</a></li>
							<li><a href="index.html"><i class="icon-font">&#xe012;</i>评论管理</a></li>
							<li><a href="index.html"><i class="icon-font">&#xe052;</i>友情链接</a></li>
							<li><a href="index.html"><i class="icon-font">&#xe033;</i>广告管理</a></li>
						</ul></li>
					<li><a href="#"><i class="icon-font">&#xe018;</i>系统管理</a>
						<ul class="sub-menu">
							<li><a href="system.html"><i class="icon-font">&#xe017;</i>系统设置</a></li>
							<li><a href="system.html"><i class="icon-font">&#xe037;</i>清理缓存</a></li>
							<li><a href="system.html"><i class="icon-font">&#xe046;</i>数据备份</a></li>
							<li><a href="system.html"><i class="icon-font">&#xe045;</i>数据还原</a></li>
						</ul></li>
				</ul>
			</div>
		</div>
		<!--/sidebar-->
		<div class="main-wrap">

			<div class="crumb-wrap">
				<div class="crumb-list">
					<i class="icon-font"></i><a href="index.html">首页</a><span
						class="crumb-step">&gt;</span><span class="crumb-name">作品管理</span>
				</div>
			</div>
			<div class="search-wrap">
				<div class="search-content">
					<form action="#" method="post">
						<table class="search-tab">
							<tr>
								<th width="120">选择分类:</th>
								<td><select name="search-sort" id="search-sort">
										<option value="18">全部</option>
										<option value="19">用户</option>
										<option value="20">摄影师</option>
								</select></td>
								<td><input class="btn btn-primary btn2" name="sub"
									value="查询"  id="sel"></td>
							</tr>
						</table>
					</form>
				</div>
			</div>
			<div class="result-wrap">
				<form name="myform" id="myform" method="post">
					<div class="result-title">
						<div class="result-list">
							<a id="batchDel" href="javascript:void(0)"><i
								class="icon-font"></i>批量删除</a> <a id="updateOrd"
								href="javascript:void(0)"><i class="icon-font"></i>更新排序</a>
						</div>
					</div>
					<div class="result-content">
						<table class="result-tab" width="100%">
							<tr>
								<th class="tc" width="5%"><input class="allChoose" name=""
									type="checkbox"></th>
								<th>排序</th>
								<th>用户ID</th>
								<th>用户名</th>
								<th>头像</th>
								<th>用户电话</th>
								<th>注册时间</th>
								<th>操作</th>
							</tr>
							<!-- <tr>
                            <td class="tc"><input name="id[]" value="58" type="checkbox"></td>
                            <td>
                                <input name="ids[]" value="58" type="hidden">
                                <input class="common-input sort-input" name="ord[]" value="0" type="text">
                            </td>
                            <td>58</td>
                            <td title="黑色经典"><a target="_blank" href="#" title="黑色经典">黑色经典</a> …
                            </td>
                            <td>0</td>
                            <td>35</td>
                            <td>admin</td>
                            <td>2013-12-30 22:34:00</td>
                            <td>
                                <a class="link-update" href="#">修改</a>
                                <a class="link-del" href="#"></a>
                            </td>
                        </tr> -->
						</table>
						<div class="list-page">2 条 1/1 页</div>
					</div>
				</form>
			</div>
		</div>
		<!--/main-->
	</div>
</body>
<script type="text/javascript">
$(document).ready(function(){
		$.post("selectindex",function(data){
			for ( var i in data) {
				if (data[i].identity=="用户") {
					$(".result-tab").append('<tr>'+
	                        '<td class="tc"><input name="id[]" value="58" type="checkbox"></td>'+
	                        '<td>'+
	                            '<input name="ids[]" value="'+data[i].id+'" type="hidden">'+
	                            '<input class="common-input sort-input" name="ord[]" value="0" type="text">'+
	                        '</td>'+
	                        '<td >'+data[i].id+'</td>'+
	                        '<td title="'+data[i].username+'"><a target="_blank" href="#" title="'+data[i].username+'">'+data[i].username+'</a>'+
	                        '</td>'+
	                        '<td><img id="image" alt="" src="'+data[i].url+'" width="150px"/></td>'+
	                        '<td>'+data[i].userphone+'</td>'+
	                        '<td>'+data[i].startTime+'</td>'+
	                        '<td>'+
	                            '<a class="link-update" href="#">修改&emsp;</a>'+
	                           '<a class="link-del" href="#" name="'+data[i].id+'">封禁&emsp;</a>'+
	                           '<a class="link-up" href="#" name="'+data[i].id+'">升级摄影师</a>'+
	                        '</td>'+
	                    '</tr>')
				} else {
					$(".result-tab").append('<tr>'+
	                        '<td class="tc"><input name="id[]" value="58" type="checkbox"></td>'+
	                        '<td>'+
	                            '<input name="ids[]" value="'+data[i].id+'" type="hidden">'+
	                            '<input class="common-input sort-input" name="ord[]" value="0" type="text">'+
	                        '</td>'+
	                        '<td >'+data[i].id+'</td>'+
	                        '<td title="'+data[i].username+'"><a target="_blank" href="#" title="'+data[i].username+'">'+data[i].username+'</a>'+
	                        '</td>'+
	                        '<td><img id="image" alt="" src="'+data[i].url+'" width="150px"/></td>'+
	                        '<td>'+data[i].userphone+'</td>'+
	                        '<td>'+data[i].startTime+'</td>'+
	                        '<td>'+
	                            '<a class="link-update" href="#">修改&emsp;</a>'+
	                           '<a class="link-del" href="#" name="'+data[i].id+'">封禁&emsp;</a>'+
	                        '</td>'+
	                    '</tr>')
				}
				
			} 
			$(".link-del").click(function(){
				 var user_id=$(this).attr("name");
		     	$.post("closeuser",{"user.id":user_id},function(data,state){
		     		if (data.isSuccess) {
						alert("封禁成功");
					} else {
						alert("封禁失败");
					}
		     		window.location.reload();
		     	})
		 	})
// ---------------------------升级摄影师!------------------------------------
		 	$(".link-up").click(function(){
				 var user_id=$(this).attr("name");
		     	$.post("upcamerapeople",{"user.id":user_id},function(data,state){
		     		if (data.isSuccess==true) {
						alert("升级成功");
						window.location.reload();
					} else if(data.isSuccess=="请您先登录"){
						alert("请您先登录");
						window.location.href="login.html";
					}else{
						alert("升级失败");
						}
		     	})
		 	})
	})
	$("#sel").click(function(){
		var sel = $("#search-sort").val();
		$(".result-tab").html("");
		$(".result-tab").append('<tr>'+
								'<th class="tc" width="5%"><input class="allChoose" name=""'+
								'type="checkbox"></th>'+
								'<th>排序</th>'+
								'<th>用户ID</th>'+
								'<th>用户名</th>'+
								'<th>头像</th>'+
								'<th>用户电话</th>'+
								'<th>注册时间</th>'+
								'<th>操作</th>'+
							'</tr>');
		$.post("selectindex_1",{"sel":sel},function(data){
			for ( var i in data) {
				if (data[i].identity=="用户") {
					$(".result-tab").append('<tr>'+
	                        '<td class="tc"><input name="id[]" value="58" type="checkbox"></td>'+
	                        '<td>'+
	                            '<input name="ids[]" value="'+data[i].id+'" type="hidden">'+
	                            '<input class="common-input sort-input" name="ord[]" value="0" type="text">'+
	                        '</td>'+
	                        '<td >'+data[i].id+'</td>'+
	                        '<td title="'+data[i].username+'"><a target="_blank" href="#" title="'+data[i].username+'">'+data[i].username+'</a>'+
	                        '</td>'+
	                        '<td><img id="image" alt="" src="'+data[i].url+'" width="150px"/></td>'+
	                        '<td>'+data[i].userphone+'</td>'+
	                        '<td>'+data[i].startTime+'</td>'+
	                        '<td>'+
	                            '<a class="link-update" href="#">修改&emsp;</a>'+
	                           '<a class="link-del" href="#" name="'+data[i].id+'">封禁&emsp;</a>'+
	                           '<a class="link-up" href="#" name="'+data[i].id+'">升级摄影师</a>'+
	                        '</td>'+
	                    '</tr>')
				} else {
					$(".result-tab").append('<tr>'+
	                        '<td class="tc"><input name="id[]" value="58" type="checkbox"></td>'+
	                        '<td>'+
	                            '<input name="ids[]" value="'+data[i].id+'" type="hidden">'+
	                            '<input class="common-input sort-input" name="ord[]" value="0" type="text">'+
	                        '</td>'+
	                        '<td >'+data[i].id+'</td>'+
	                        '<td title="'+data[i].username+'"><a target="_blank" href="#" title="'+data[i].username+'">'+data[i].username+'</a>'+
	                        '</td>'+
	                        '<td><img id="image" alt="" src="'+data[i].url+'" width="150px"/></td>'+
	                        '<td>'+data[i].userphone+'</td>'+
	                        '<td>'+data[i].startTime+'</td>'+
	                        '<td>'+
	                            '<a class="link-update" href="#">修改&emsp;</a>'+
	                           '<a class="link-del" href="#" name="'+data[i].id+'">封禁&emsp;</a>'+
	                           /* '<a class="link-up" href="#" name="'+data[i].id+'">升级摄影师</a>'+ */
	                        '</td>'+
	                    '</tr>')
					}
				}
			$(".link-del").click(function(){
				 var user_id=$(this).attr("name");
		     	$.post("closeuser",{"user.id":user_id},function(data,state){
		     		if (data.isSuccess) {
						alert("封禁成功");
					} else {
						alert("封禁失败");
					}
		     		window.location.reload();
		     	})
		 	})
//---------------------------升级摄影师!------------------------------------
		 	$(".link-up").click(function(){
				 var user_id=$(this).attr("name");
		     	$.post("upcamerapeople",{"user.id":user_id},function(data,state){
		     		if (data.isSuccess==true) {
						alert("升级成功");
						window.location.reload();
					} else if(data.isSuccess=="请您先登录"){
						alert("请您先登录");
						window.location.href="login.html";
					}else{
						alert("升级失败");
						}
		     	})
		 	})
		})
	})
})
</script>
</html>